package com.hibase.core.lock.redis.config;

import com.hibase.core.lock.redis.executor.RedisTemplateLockExecutor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * RedisTemplate锁自动配置器
 * @author chenfeng
 * @version 1.0
 * @date 2021/10/22 17:09
 * @des https://gitee.com/cheershi
 */
@Configuration
@ConditionalOnClass(RedisOperations.class)
public class RedisTemplateLockAutoConfiguration {

    @Bean
    @Order(200)
    public RedisTemplateLockExecutor redisTemplateLockExecutor(RedisTemplate redisTemplate) {
        return new RedisTemplateLockExecutor(redisTemplate);
    }
}
